{extend name="admin@index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <input type="hidden" name="id" value="{$data.id}">
    <div class="layui-form-item">
        <label class="layui-form-label ">选择会员</label>
        <div class="layui-input-block">
            <div class="sp_container" style="width: 100%;"><input class="form-control layui-input selectpage sp_input"
                                                                  type="text" name="row[member_id]"
                                                                  data-source="/admin/member2.member/index.html"
                                                                  data-multiple="false" data-field="nickname"
                                                                  data-primary-key="id" data-max-select-limit="20"
                                                                  data-pagination="true" data-page-size="10"
                                                                  data-order-by="id" value="" autocomplete="off"
                                                                  id="row[member_id]"><input type="hidden"
                                                                                           class="sp_hidden"
                                                                                           name="member_id" id="row[xl]"
                                                                                           value="">
                <div class="sp_button" title="关闭 (Tab键)"><span class="sp_caret"></span></div>
            </div>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="row[name]" lay-verify="required" autocomplete="off" placeholder="姓名" class="layui-input"
                   value="{$data.name}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input type="text" name="row[phone]" lay-verify="required" autocomplete="off" placeholder="电话" class="layui-input"
                   value="{$data.phone}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">身份证号</label>
        <div class="layui-input-block">
            <input type="text" name="row[sf_id]" lay-verify="required" autocomplete="off" placeholder="身份证号" class="layui-input"
                   value="{$data.sf_id}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">驾照</label>
        <div class="layui-input-block">
            <div class="w300">
                <input value="{$data.driver_img}" type="text" lay-verify="required" name="row[driver_img]" id="c-pic222"
                       class="layui-input">
            </div>
            <button type="button" class="layui-btn faupload" id="faupload-pic222" data-multiple="false"
                    data-input-id="c-pic222"
                    data-preview-id="p-pic222" data-type="image"><i class="layui-icon layui-icon-upload"></i> 上传
            </button>
            <button type="button" class="layui-btn fachoose" data-multiple="false" data-mimetype="image"
                    data-input-id="c-pic222" id="fachoose-c-pic222"><i class="iconfont icon-other"></i> 选择
            </button>
            <ul class="layui-row list-inline plupload-preview" id="p-pic222"></ul>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">省</label>
        <div class="layui-input-block">
            <select name="row[province]" lay-verify="required" lay-filter="ccc62">
                <option value="">请选择省</option>
                {volist name="proviec" id="vo"}
                <!--                <option  value="{$key.id}"  name="row[operate_type]">{$key.name}</option>-->
                <option value="{$vo.name}"
                <?php if( $vo['name'] == $data['province']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">市</label>
        <div class="layui-input-block">
            <select id="c-city" name="row[city]" lay-verify="required" lay-filter="c-city">
                <option value="">请选择市</option>
                {volist name="city_list" id="vo"}
                <option value="{$vo.name}"
                <?php if( $vo['name'] == $data['city']){ ?> selected <?php }?>>{$vo.name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">佣金百分比</label>
        <div class="layui-input-block">
            <input type="number" name="row[discount]" lay-verify="required" value="{$data.discount}" autocomplete="off" placeholder="佣金百分比"
                   class="layui-input">
        </div>
    </div>



    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit>提交</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['yznForm', 'laydate', 'form'], function () {
        var yznForm = layui.yznForm,
            laydate = layui.laydate;
        var form = layui.form;
        yznForm.bindevent($("form.layui-form"));
        laydate.render({
            elem: '#ID-laydate'
        });
        form.on('select(ccc6)', function (data) {
            console.log(data.value);
            if (data.value == 3) {
                $(".c5").show();
            } else {
                $(".c5").hide();
            }
            form.render();
        });

        form.on('select(ccc62)', function (data) {
            console.log(data.value);
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {
                        $("#c-city").empty();
                        var str = "<option value>请选择市</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city").append(str);

                        $("#c-city2").empty();
                        var str2 = "<option value>请选择区</option>";
                        $("#c-city2").append(str2);

                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

        form.on('select(c-city)', function (data) {
            $.ajax({
                type: "POST",//规定传输方式
                url: "{:url('getc_cate')}",//提交URL
                data: {'id': data.value},//提交的数据
                success: function (result) {
                    if (result.code == 200) {

                        $("#c-city2").empty();
                        var str = "<option value>请选择区</option>";
                        $.each(result.data, function (i, val) {
                            str += '<option value=' + val.name + '>' + val.name + '</option>'
                        });
                        $("#c-city2").append(str);
                        layui.form.render('select');
                    }
                },
                error: function () {
                    alert("获取信息失败")
                }
            });
            form.render();
        });

    });
</script>
{/block}